home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’90 / Busy Box / Sources / FYAH.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-14  |  1.2 KB  |  61 lines  |  [TEXT/KAHL]

  1. /* file: FYAH.c    
  2.     puts up a fake dissassembly, similar to Arnold's Terminator special effects.
  3.     the acronym comes from the famous line, which is not allowable in a family environment
  4.     By MGD
  5. */
  6.  
  7. #include "busybox.h"
  8.  
  9. #define numStrings    20
  10. #define    stringID        401
  11. #define    lineSlew        12
  12. static Rect    yourRect;
  13. Str255    strangs[numStrings];
  14. static int16 lastVert;
  15. static int16 bottom;
  16.  
  17. #define abs(x)    ((x <= 0) ? (-x) : (x))
  18.  
  19. void InitFYAHObj(Rect *drawArea, int16 ID)    {
  20.     int16    i;
  21.     
  22.     yourRect = *drawArea;
  23.     for (i = 0; i < numStrings; i++)    {
  24.         GetIndString(&strangs[i], stringID, i+1);
  25.     }
  26.     lastVert = 0;
  27.     bottom = yourRect.bottom;
  28.     
  29.     OffsetRect(&yourRect, yourRect.left, yourRect.top);
  30.     SetRect(&yourRect, 0, 0, 500, 500);    /* kludge    */
  31.     
  32. }    /* InitRandomDotObj    */
  33.  
  34.  
  35.  
  36. void DrawFYAHObj(int16 ID)    {
  37.     int16 z,x;
  38.     RgnHandle    tempRgn;
  39.     
  40.     if (Random() > 10000) return;
  41.     
  42.     TextSize(9);
  43.     tempRgn = NewRgn();
  44.  
  45.     if ((lastVert + lineSlew) > bottom)    {
  46.         /* scroll */
  47.         ScrollRect(&yourRect, 0, -lineSlew, tempRgn);
  48.         EraseRgn(tempRgn);
  49.         DisposeRgn(tempRgn);
  50.         lastVert -= lineSlew;
  51.     }
  52.     lastVert += lineSlew;
  53.     MoveTo(3,lastVert);
  54.     z = Random();
  55.     x = abs(z) % numStrings;
  56.     DrawString(strangs[x]);
  57. }    /* DrawRandomDotObj    */
  58.  
  59.  
  60.  
  61.